Skip to content

feat(nextjs): Improve debug logging - #1866

Merged
brkalow merged 5 commits into
mainfrom
brk.feat/improve-next-debug-logs
Oct 12, 2023
Merged

feat(nextjs): Improve debug logging#1866
brkalow merged 5 commits into
mainfrom
brk.feat/improve-next-debug-logs

Conversation

@brkalow

@brkalow brkalow commented Oct 12, 2023

Copy link
Copy Markdown
Member

Description

Updates our debug logger to use individual console.log calls for each line. This is done to avoid platform log limitations per call. Along with this, I've improved the output of the logger slightly and added the relevant package versions to the log footer.

I did not add a unique ID to the output as the logs are still all logged together.

Output:

[clerk debug start: auth()]
  Headers debug, {
    "authStatus": "signed-in"
  }
  Options debug, {
    "apiKey": "",
    "secretKey": "sk_test_*********QDo",
    "apiUrl": "https://api.clerk.dev",
    "apiVersion": "v1",
    "authStatus": "signed-in"
  }
  JWT debug, <truncated>
[clerk debug end: auth()] (@clerk/nextjs=4.25.3,next=13.5.4)

fixes JS-716
fixes #1683

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@brkalow
brkalow requested a review from a team as a code owner October 12, 2023 02:51
@changeset-bot

changeset-bot Bot commented Oct 12, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 27df664

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@octoper octoper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@dimkl dimkl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☁️ I think we should add a ticket to handle the logging using a logger adapter to provide and use a default logger adapter that will handle truncating for Vercel, single-line logs, ...

Comment thread packages/nextjs/src/utils/debugLogger.test.ts Outdated
}

function debugLogFooter(name: string) {
return `[clerk debug end: ${name}] (@clerk/nextjs=${PACKAGE_VERSION},next=${nextPkg.version})`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@brkalow
brkalow enabled auto-merge October 12, 2023 14:45
@brkalow
brkalow added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit b72a799 Oct 12, 2023
@brkalow
brkalow deleted the brk.feat/improve-next-debug-logs branch October 12, 2023 14:53
@clerk-cookie clerk-cookie mentioned this pull request Oct 12, 2023
@clerk-cookie

Copy link
Copy Markdown
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@clerk/nextjs logs are truncated on netlify

4 participants